package com.correction.classes;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import com.correction.classes.Utilisateur.Niveau;

@Entity
@Table(name = "exercice")
public class Exercice {

	public enum Langage {
		CPP, JAVA, C, PHP
	}

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	private int id;

	@Column(name = "Langage")
	@Enumerated(EnumType.STRING)
	private Langage langage;
	@Column(name = "nombrePoint")
	private float nombrePoint;
	@Column(name = "titre")
	private String titre;
	// @Column(name = "niveau")
	// @Enumerated(EnumType.STRING)
	// private Niveau niveau;
	@Column(name = "enonce")
	private String enonce;
	@Column(name = "dureeEnMinute")
	private int dureeEnMinute;
	@Column(name = "datePublication")
	private Date datePublication;
	@Column(name = "statut")
	private boolean statut;
	
	
	
	@Column(name = "toUse")
	private String toUse;
	public String getToUse() {
		return toUse;
	}

	public void setToUse(String toUse) {
		this.toUse = toUse;
	}

	public String getToNotUse() {
		return toNotUse;
	}

	public void setToNotUse(String toNotUse) {
		this.toNotUse = toNotUse;
	}

	public String getParams() {
		return params;
	}

	public void setParams(String params) {
		this.params = params;
	}

	@Column(name = "toNotUse")
	private String toNotUse;
	
	
	@Column(name = "params")
	private String params;
	@Column(name = "resultat")
	private String resultat;
	



	public String getResultat() {
		return resultat;
	}

	public void setResultat(String resultat) {
		this.resultat = resultat;
	}



	public String getTitre() {
		return titre;
	}

	public void setTitre(String titre) {
		this.titre = titre;
	}

	public boolean getStatut() {
		return statut;
	}

	public void setStatut(boolean statut) {
		this.statut = statut;
	}

	public int getId() {
		return id;
	}

	public void setId(int id) {
		this.id = id;
	}

	public Langage getLangage() {
		return langage;
	}

	public void setLangage(Langage langage) {
		this.langage = langage;
	}

	public float getNombrePoint() {
		return nombrePoint;
	}

	public void setNombrePoint(float nombrePoint) {
		this.nombrePoint = nombrePoint;
	}

	// public Niveau getNiveau() {
	// return niveau;
	// }
	//
	// public void setNiveau(Niveau niveau) {
	// this.niveau = niveau;
	// }

	public String getEnonce() {
		return enonce;
	}

	public void setEnonce(String enonce) {
		this.enonce = enonce;
	}

	public int getDureeEnMinute() {
		return dureeEnMinute;
	}

	public void setDureeEnMinute(int dureeEnMinute) {
		this.dureeEnMinute = dureeEnMinute;
	}

	public Date getDatePublication() {
		return datePublication;
	}

	public void setDatePublication(Date datePublication) {
		this.datePublication = datePublication;
	}

	public Exercice() {
		super();
	}

	public Exercice(String titre, Langage langage, float nombrePoint,
			String enonce, int dureeEnMinute, Date datePublication,
			boolean statut) {
		super();
		this.langage = langage;
		this.nombrePoint = nombrePoint;
		this.titre = titre;
		// this.niveau = niveau;
		this.enonce = enonce;
		this.dureeEnMinute = dureeEnMinute;
		this.datePublication = datePublication;
		this.statut = statut;
	}

	@Override
	public String toString() {
		return "Exercice [id=" + id + ", langage=" + langage + ", nombrePoint="
				+ nombrePoint + ", titre=" + titre + ", enonce=" + enonce
				+ ", dureeEnMinute=" + dureeEnMinute + ", datePublication="
				+ datePublication + ", statut=" + statut + "]";
	}

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result
				+ ((datePublication == null) ? 0 : datePublication.hashCode());
		result = prime * result + dureeEnMinute;
		result = prime * result + ((enonce == null) ? 0 : enonce.hashCode());
		result = prime * result + id;
		result = prime * result + ((langage == null) ? 0 : langage.hashCode());
		result = prime * result + Float.floatToIntBits(nombrePoint);
		result = prime * result + (statut ? 1231 : 1237);
		result = prime * result + ((titre == null) ? 0 : titre.hashCode());
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Exercice other = (Exercice) obj;
		if (datePublication == null) {
			if (other.datePublication != null)
				return false;
		} else if (!datePublication.equals(other.datePublication))
			return false;
		if (dureeEnMinute != other.dureeEnMinute)
			return false;
		if (enonce == null) {
			if (other.enonce != null)
				return false;
		} else if (!enonce.equals(other.enonce))
			return false;
		if (id != other.id)
			return false;
		if (langage != other.langage)
			return false;
		if (Float.floatToIntBits(nombrePoint) != Float
				.floatToIntBits(other.nombrePoint))
			return false;
		if (statut != other.statut)
			return false;
		if (titre == null) {
			if (other.titre != null)
				return false;
		} else if (!titre.equals(other.titre))
			return false;
		return true;
	}

}
